import json

#str==>json  dumps
json_data='{"name":"xiaowang","age":18,"address":"beijing"}'
jd=json.dumps(json_data)   #字符串转json
print(jd)


#json==>dict
jd2=json.loads(json_data) #json转字典
print(jd2)

#dict==>json
dic={'name': 'xiaowang', 'age': 18, 'address': 'beijing'}
print(dic)
dic_json=json.dumps(dic)  #字典转json
print(dic_json)
str_dic=json.loads(dic_json) #json转字典
print(str_dic)






